<?php
#user model
if(!defined('_CONST_VERSION'))
{
	die("Access Exit!");
}

/**
 * 获取用户相册
 */
 function get_thumbfile_by_userid($userid)
 {
	global $database;
	$rs = $database->queryArray("SELECT * FROM thumb_file WHERE user_id = " . $userid . " ORDER BY createtime DESC");
	return $rs; 
 }
 
 /**
  * 检查是否存在用户
  */
  function check_user($uid)
  {
	global $database;
	$rs = $database->queryFirst("SELECT u.*, ui.avatar FROM user u LEFT JOIN user_info ui ON u.id = ui.user_id  WHERE u.id=".$uid);
	if(isset($rs['id'])){
		return $rs;
	}else{
		return false;
	}
  }

/**
 * 获得用户资料
 */
function get_userinfo()
{
	global $database;
	$rs = $database->queryFirst("SELECT * FROM user_info WHERE user_id=".$_SESSION['userid']);	
	return $rs;
} 
?>